package com.heihei.videopreview;


import com.heihei.constant.MessageConstant;

import java.awt.image.BufferedImage;
import java.io.File;
import java.util.List;

public class MergeVideoGenerateBufferedImgThread implements Runnable {
    private CreateVideoPreview CVP;
    private File videoFile;
    private Integer count;
    List<BufferedImage> imgList;
    private String threadId;

    public MergeVideoGenerateBufferedImgThread(String threadId, CreateVideoPreview CVP, File videoFile, Integer count, List<BufferedImage> imgList) {
        this.threadId = threadId;
        this.CVP = CVP;
        this.videoFile = videoFile;
        this.count = count;
        this.imgList = imgList;
    }

    @Override
    public void run() {
        System.out.println("正在处理视频文件：" + this.videoFile.getAbsolutePath());
        List<BufferedImage> currImgList = this.CVP.splitVideo(this.videoFile, this.count);
        imgList.addAll(currImgList);
        VideoPreviewStart.CURRENT_VIDEO_HANDLING_MAP.remove(this.threadId);
        System.out.println(MessageConstant.CONGRATULATIONS + " 视频文件提取成功：" + this.videoFile.getAbsolutePath());
    }
}